<html>
<body>
<br><br><br>
<center>
<form action="a.php" method="POST">
 query :<textarea name="query" cols="35" rows="1"></textarea><br>
 dataset: 
<select name="dataset">
<?php
//Open directory
$dir = dir("./");

//List files in directory
while (($file = $dir->read()) !== false){
	//Make sure it's a .txt file
	if(strlen($file) < 5 || substr($file, -4) != '.txt')
		continue;
		
	echo "<option value=\"$file\">$file</option>";
}

$dir->close();
?>
</select>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<input name="submit" type="submit" value="submit">
</form>
</center>
</body>
<html>